/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package java2d;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author Mydelin
 */
public class graf {

    
    public static void main( String args[] ) throws IOException  {
       
     
    }
    
    public void Graficar(int grado, float x1,float a1, float b1, float c1, float d1)  throws IOException {
        
        //Graficar(g,x,a:b:c:d);
        //grado 1 Graficar(g,x,a:b:0:0);
        //grado 2 Graficar(g,x,a:b:c:0);
        //grado 3 Graficar(g,x,a:b:c:d);
        
        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));

         float y = 0;
        
      
       // System.out.println ("Introduzca el grado: ");
        //String gg = br.readLine ();
        int  g;
        
        g=grado;
         
            switch(g){
            
            case 1:  
                float x;
                float a;
                float b;
                  
                  x=x1;
                  a=a1;
                  b=b1;
                
     
                for (int in=0; in<=x; in++){  
                      y = (a * in) + b;
                      System.out.println ("Y = " + y);
                   }
                
                break;
                
            case 2:
             
                float z;
                float f;
                float h;
                float i;
                  z=x1;
                  f=a1;
                  h=b1;
                  i=c1;
                
                   for (int in=0; in<=z; in++){  
                     float k = (float) Math.pow(in,2);     
                      y = ((f * k) + (h * in)) + i;
                      System.out.println ("Y = " + y);
                   }
                 
                break;
            case 3:
                //System.out.println ("Introduzca el valor de X: ");
                //String ll = br.readLine ();
                float l ;
                
                //System.out.println ("Introduzca a: ");
                //String mm = br.readLine ();
                float m ;

                //System.out.println ("Introduzca b: ");
                //String nn = br.readLine ();
                float n ;
                
                //System.out.println ("Introduzca c: ");
                //String oo = br.readLine ();
                float o;
                
                //System.out.println ("Introduzca d: ");
                //String pp = br.readLine ();
                float p;
               
                  l=x1;
                  m=a1;
                  n=b1;
                  o=c1;
                  p=d1;
                
                for (int in=0; in<=l; in++){       
                
                float r = (float) Math.pow(in,3);
                float s = (float) Math.pow(in,2);
                
                y = ((m * r) + (n * s) + (o * in)) + p;
                
                System.out.println ("Y = " + y);
                
                }
                
                break;
                
             default: 
                System.out.println("El grado debe se de 1 a 3");
                 break;
                     
        }
            
   
    }
}
